export default {
	data(){
		return {
			bgColor:"transparent",
			navHeight:"",
		}
	},
	methods:{
		back(){
			if(getCurrentPages().length==1){
				console.log("trigger----")
				uni.switchTab({
					url:"/pages/index/index/index"
				})
				return
			}
			uni.navigateBack({
				delta:1
			})
		}
	},
	onPageScroll({scrollTop}){
		this.bgColor=`rgba(255,255,255,${scrollTop/this.navHeight>=1?1:scrollTop/this.navHeight})`
	},
	onReady(){
		const query = uni.createSelectorQuery().in(this);
		query.select('#nav').boundingClientRect(data => {
			if(data){
				this.navHeight=data.height;
			}
		}).exec();
	}
}